<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>湖北康正物业服务有限公司</title>
<LINK href="images/css.css" type="text/css" rel="stylesheet">
<script type="text/javascript">

	function checkForm() {
		var deptId = document.getElementById("deptId").value;
		var deptName = document.getElementById("deptName").value;
				
		if (deptId == 0) {
			alert("请输入部门编号！");
			return false;
		}
		if (deptName == 0) {
			alert("请输入部门名称！");
			return false;
		}
	}
</script>
</head>
<body>
  <table class="tableline" cellspacing="1" cellpadding="0" width="100%" border="0">
    <html:form action="department.do?method=save" method="post" onsubmit="return checkForm();">
    <tr>
      <td class="STYLE4" align="center" bgcolor="#ffffff" colspan="2" height="40">添加修改部门</td>
    </tr>
    <tr>
      <td width="217" height="26" align="right" bgcolor="#ffffff">部门代码:</td>
      <td width="773" bgcolor="#ffffff"><label for="textfield"></label>
        &nbsp;<html:text property="deptId" value="${dept.deptId }"/>
        <font color="red">${deptIdError }${deptIdRequest }</font></td>
    </tr>
    <tr>
      <td height="26" align="right" bgcolor="#ffffff">部门名称:</td>
      <td bgcolor="#ffffff"><label for="textfield2"></label>
       &nbsp;<html:text property="deptName" value="${dept.deptName }"/>
        &nbsp;<html:submit value="增加部门" />&nbsp;<font color="red">${deptNameError }</font></td>
    </tr>
    </html:form>
    <tr>
      <td colspan="2" align="center" bgcolor="#ffffff">
      <table width="100%" border="0">
        <tr align="center">
          <td width="25%" height="25">部门代码</td>
          <td width="25%">部门名称</td>
          <td width="25%">操作</td>
        </tr>
        <c:if test="${!empty deptList}">
				<c:forEach items="${deptList}" var="dept">
        <tr align="center">
          <td height="25">${dept.deptId }</td>
          <td><a href="department.do?method=clazzList&id=${dept.id }">${dept.deptName }</a></td>
          <td><a href="department.do?method=update&id=${dept.id }">编辑</a>&nbsp;<a href="department.do?method=delete&id=${dept.id }">删除</a></td>
        </tr>
        </c:forEach>
        </c:if>
      </table>
      </td>
    </tr>
  </table>
</body>
</html>